home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / tpfort17.zip / FORTRAN.BUG < prev    next >
Text File  |  1989-11-19  |  1KB  |  39 lines

  1. When I tested TPFORT on my XT clone machine, I found that it regularly 
  2. crashed.  I spent several hours trying to see what I was doing wrong, but it 
  3. turned out to be a bug in the Fortran 5.0 run-time library routine 
  4. __init80x87. It had the sequence 
  5.  
  6.   FSTCW  [BP-4]
  7.   FNINIT
  8.   MOV    CX,01Eh
  9.   LOOP   in place
  10.  
  11. What happens on an 8087 is that the FNINIT aborts the FSTCW instruction, and 
  12. the control word never got stored.  Later on a garbage control word was loaded
  13. and the system crashed.  A fix that seems to work is to put the delay loop 
  14. before the FNINIT.  I'm not sure what the original programmer would have 
  15. been thinking of writing it this way; the next instruction is an arithmetic
  16. one that is preceded by a WAIT anyways.
  17.  
  18. To patch the library LLIBFOR7.LIB, search for the original bytes
  19.  
  20.   9B D9 7E FC     
  21.   DB E3
  22.   B9 1E 00
  23.   E2 FE
  24.  
  25. and replace them with
  26.  
  27.   9B D9 7E FC     ; no change
  28.   B9 1E 00        ; line 3 above
  29.   E2 FE           ; line 4 above
  30.   DB E3           ; line 2 above
  31.  
  32. In my copy of the library the first 6 bytes of the original gave a unique search
  33. string.  I'd guess it's safe to do the same patch on any other library; the 
  34. original code would never make sense.  I believe it works on a 287 or 387 
  35. because the FSTCW completes even without any following delay.
  36.  
  37. Duncan Murdoch
  38.  
  39.